{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Problem Statement\n",
    "https://www.kaggle.com/c/stumbleupon"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from bs4 import BeautifulSoup\n",
    "import pandas as pd\n",
    "pd.options.display.max_columns = 100"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "base_path = \"/data/kaggle/evergreen/\"\n",
    "def get_path(filename):\n",
    "    return base_path + filename"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>url</th>\n",
       "      <th>urlid</th>\n",
       "      <th>boilerplate</th>\n",
       "      <th>alchemy_category</th>\n",
       "      <th>alchemy_category_score</th>\n",
       "      <th>avglinksize</th>\n",
       "      <th>commonlinkratio_1</th>\n",
       "      <th>commonlinkratio_2</th>\n",
       "      <th>commonlinkratio_3</th>\n",
       "      <th>commonlinkratio_4</th>\n",
       "      <th>compression_ratio</th>\n",
       "      <th>embed_ratio</th>\n",
       "      <th>framebased</th>\n",
       "      <th>frameTagRatio</th>\n",
       "      <th>hasDomainLink</th>\n",
       "      <th>html_ratio</th>\n",
       "      <th>image_ratio</th>\n",
       "      <th>is_news</th>\n",
       "      <th>lengthyLinkDomain</th>\n",
       "      <th>linkwordscore</th>\n",
       "      <th>news_front_page</th>\n",
       "      <th>non_markup_alphanum_characters</th>\n",
       "      <th>numberOfLinks</th>\n",
       "      <th>numwords_in_url</th>\n",
       "      <th>parametrizedLinkRatio</th>\n",
       "      <th>spelling_errors_ratio</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>http://www.bloomberg.com/news/2010-12-23/ibm-p...</td>\n",
       "      <td>4042</td>\n",
       "      <td>{\"title\":\"IBM Sees Holographic Calls Air Breat...</td>\n",
       "      <td>business</td>\n",
       "      <td>0.789131</td>\n",
       "      <td>2.055556</td>\n",
       "      <td>0.676471</td>\n",
       "      <td>0.205882</td>\n",
       "      <td>0.047059</td>\n",
       "      <td>0.023529</td>\n",
       "      <td>0.443783</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.090774</td>\n",
       "      <td>0</td>\n",
       "      <td>0.245831</td>\n",
       "      <td>0.003883</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>24</td>\n",
       "      <td>0</td>\n",
       "      <td>5424</td>\n",
       "      <td>170</td>\n",
       "      <td>8</td>\n",
       "      <td>0.152941</td>\n",
       "      <td>0.079130</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>http://www.popsci.com/technology/article/2012-...</td>\n",
       "      <td>8471</td>\n",
       "      <td>{\"title\":\"The Fully Electronic Futuristic Star...</td>\n",
       "      <td>recreation</td>\n",
       "      <td>0.574147</td>\n",
       "      <td>3.677966</td>\n",
       "      <td>0.508021</td>\n",
       "      <td>0.288770</td>\n",
       "      <td>0.213904</td>\n",
       "      <td>0.144385</td>\n",
       "      <td>0.468649</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.098707</td>\n",
       "      <td>0</td>\n",
       "      <td>0.203490</td>\n",
       "      <td>0.088652</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>40</td>\n",
       "      <td>0</td>\n",
       "      <td>4973</td>\n",
       "      <td>187</td>\n",
       "      <td>9</td>\n",
       "      <td>0.181818</td>\n",
       "      <td>0.125448</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>http://www.menshealth.com/health/flu-fighting-...</td>\n",
       "      <td>1164</td>\n",
       "      <td>{\"title\":\"Fruits that Fight the Flu fruits tha...</td>\n",
       "      <td>health</td>\n",
       "      <td>0.996526</td>\n",
       "      <td>2.382883</td>\n",
       "      <td>0.562016</td>\n",
       "      <td>0.321705</td>\n",
       "      <td>0.120155</td>\n",
       "      <td>0.042636</td>\n",
       "      <td>0.525448</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.072448</td>\n",
       "      <td>0</td>\n",
       "      <td>0.226402</td>\n",
       "      <td>0.120536</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>55</td>\n",
       "      <td>0</td>\n",
       "      <td>2240</td>\n",
       "      <td>258</td>\n",
       "      <td>11</td>\n",
       "      <td>0.166667</td>\n",
       "      <td>0.057613</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>http://www.dumblittleman.com/2007/12/10-foolpr...</td>\n",
       "      <td>6684</td>\n",
       "      <td>{\"title\":\"10 Foolproof Tips for Better Sleep \"...</td>\n",
       "      <td>health</td>\n",
       "      <td>0.801248</td>\n",
       "      <td>1.543103</td>\n",
       "      <td>0.400000</td>\n",
       "      <td>0.100000</td>\n",
       "      <td>0.016667</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.480725</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.095861</td>\n",
       "      <td>0</td>\n",
       "      <td>0.265656</td>\n",
       "      <td>0.035343</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>24</td>\n",
       "      <td>0</td>\n",
       "      <td>2737</td>\n",
       "      <td>120</td>\n",
       "      <td>5</td>\n",
       "      <td>0.041667</td>\n",
       "      <td>0.100858</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>http://bleacherreport.com/articles/1205138-the...</td>\n",
       "      <td>9006</td>\n",
       "      <td>{\"title\":\"The 50 Coolest Jerseys You Didn t Kn...</td>\n",
       "      <td>sports</td>\n",
       "      <td>0.719157</td>\n",
       "      <td>2.676471</td>\n",
       "      <td>0.500000</td>\n",
       "      <td>0.222222</td>\n",
       "      <td>0.123457</td>\n",
       "      <td>0.043210</td>\n",
       "      <td>0.446143</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.024908</td>\n",
       "      <td>0</td>\n",
       "      <td>0.228887</td>\n",
       "      <td>0.050473</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "      <td>12032</td>\n",
       "      <td>162</td>\n",
       "      <td>10</td>\n",
       "      <td>0.098765</td>\n",
       "      <td>0.082569</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                 url  urlid  \\\n",
       "0  http://www.bloomberg.com/news/2010-12-23/ibm-p...   4042   \n",
       "1  http://www.popsci.com/technology/article/2012-...   8471   \n",
       "2  http://www.menshealth.com/health/flu-fighting-...   1164   \n",
       "3  http://www.dumblittleman.com/2007/12/10-foolpr...   6684   \n",
       "4  http://bleacherreport.com/articles/1205138-the...   9006   \n",
       "\n",
       "                                         boilerplate alchemy_category  \\\n",
       "0  {\"title\":\"IBM Sees Holographic Calls Air Breat...         business   \n",
       "1  {\"title\":\"The Fully Electronic Futuristic Star...       recreation   \n",
       "2  {\"title\":\"Fruits that Fight the Flu fruits tha...           health   \n",
       "3  {\"title\":\"10 Foolproof Tips for Better Sleep \"...           health   \n",
       "4  {\"title\":\"The 50 Coolest Jerseys You Didn t Kn...           sports   \n",
       "\n",
       "  alchemy_category_score  avglinksize  commonlinkratio_1  commonlinkratio_2  \\\n",
       "0               0.789131     2.055556           0.676471           0.205882   \n",
       "1               0.574147     3.677966           0.508021           0.288770   \n",
       "2               0.996526     2.382883           0.562016           0.321705   \n",
       "3               0.801248     1.543103           0.400000           0.100000   \n",
       "4               0.719157     2.676471           0.500000           0.222222   \n",
       "\n",
       "   commonlinkratio_3  commonlinkratio_4  compression_ratio  embed_ratio  \\\n",
       "0           0.047059           0.023529           0.443783          0.0   \n",
       "1           0.213904           0.144385           0.468649          0.0   \n",
       "2           0.120155           0.042636           0.525448          0.0   \n",
       "3           0.016667           0.000000           0.480725          0.0   \n",
       "4           0.123457           0.043210           0.446143          0.0   \n",
       "\n",
       "   framebased  frameTagRatio  hasDomainLink  html_ratio  image_ratio is_news  \\\n",
       "0           0       0.090774              0    0.245831     0.003883       1   \n",
       "1           0       0.098707              0    0.203490     0.088652       1   \n",
       "2           0       0.072448              0    0.226402     0.120536       1   \n",
       "3           0       0.095861              0    0.265656     0.035343       1   \n",
       "4           0       0.024908              0    0.228887     0.050473       1   \n",
       "\n",
       "   lengthyLinkDomain  linkwordscore news_front_page  \\\n",
       "0                  1             24               0   \n",
       "1                  1             40               0   \n",
       "2                  1             55               0   \n",
       "3                  0             24               0   \n",
       "4                  1             14               0   \n",
       "\n",
       "   non_markup_alphanum_characters  numberOfLinks  numwords_in_url  \\\n",
       "0                            5424            170                8   \n",
       "1                            4973            187                9   \n",
       "2                            2240            258               11   \n",
       "3                            2737            120                5   \n",
       "4                           12032            162               10   \n",
       "\n",
       "   parametrizedLinkRatio  spelling_errors_ratio  label  \n",
       "0               0.152941               0.079130      0  \n",
       "1               0.181818               0.125448      1  \n",
       "2               0.166667               0.057613      1  \n",
       "3               0.041667               0.100858      1  \n",
       "4               0.098765               0.082569      0  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_train = pd.read_csv(get_path(\"train.tsv\"), sep=\"\\t\")\n",
    "df_train.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>url</th>\n",
       "      <th>urlid</th>\n",
       "      <th>boilerplate</th>\n",
       "      <th>alchemy_category</th>\n",
       "      <th>alchemy_category_score</th>\n",
       "      <th>avglinksize</th>\n",
       "      <th>commonlinkratio_1</th>\n",
       "      <th>commonlinkratio_2</th>\n",
       "      <th>commonlinkratio_3</th>\n",
       "      <th>commonlinkratio_4</th>\n",
       "      <th>compression_ratio</th>\n",
       "      <th>embed_ratio</th>\n",
       "      <th>framebased</th>\n",
       "      <th>frameTagRatio</th>\n",
       "      <th>hasDomainLink</th>\n",
       "      <th>html_ratio</th>\n",
       "      <th>image_ratio</th>\n",
       "      <th>is_news</th>\n",
       "      <th>lengthyLinkDomain</th>\n",
       "      <th>linkwordscore</th>\n",
       "      <th>news_front_page</th>\n",
       "      <th>non_markup_alphanum_characters</th>\n",
       "      <th>numberOfLinks</th>\n",
       "      <th>numwords_in_url</th>\n",
       "      <th>parametrizedLinkRatio</th>\n",
       "      <th>spelling_errors_ratio</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>http://www.lynnskitchenadventures.com/2009/04/...</td>\n",
       "      <td>5865</td>\n",
       "      <td>{\"title\":\"Homemade Enchilada Sauce Lynn s Kitc...</td>\n",
       "      <td>recreation</td>\n",
       "      <td>0.443906</td>\n",
       "      <td>2.558140</td>\n",
       "      <td>0.389706</td>\n",
       "      <td>0.257353</td>\n",
       "      <td>0.044118</td>\n",
       "      <td>0.022059</td>\n",
       "      <td>0.489572</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.067143</td>\n",
       "      <td>0</td>\n",
       "      <td>0.230285</td>\n",
       "      <td>0.199438</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>15</td>\n",
       "      <td>0</td>\n",
       "      <td>5643</td>\n",
       "      <td>136</td>\n",
       "      <td>3</td>\n",
       "      <td>0.242647</td>\n",
       "      <td>0.080597</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>http://lolpics.se/18552-stun-grenade-ar</td>\n",
       "      <td>782</td>\n",
       "      <td>{\"title\":\"lolpics Stun grenade ar \",\"body\":\" f...</td>\n",
       "      <td>culture_politics</td>\n",
       "      <td>0.135844</td>\n",
       "      <td>3.771429</td>\n",
       "      <td>0.461538</td>\n",
       "      <td>0.205128</td>\n",
       "      <td>0.051282</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.782051</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.042857</td>\n",
       "      <td>0</td>\n",
       "      <td>0.365962</td>\n",
       "      <td>0.080000</td>\n",
       "      <td>?</td>\n",
       "      <td>1</td>\n",
       "      <td>62</td>\n",
       "      <td>0</td>\n",
       "      <td>382</td>\n",
       "      <td>39</td>\n",
       "      <td>2</td>\n",
       "      <td>0.128205</td>\n",
       "      <td>0.176471</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>http://www.xcelerationfitness.com/treadmills.html</td>\n",
       "      <td>6962</td>\n",
       "      <td>{\"title\":\"Treadmills \",\"body\":\" treadmills, st...</td>\n",
       "      <td>?</td>\n",
       "      <td>?</td>\n",
       "      <td>2.269565</td>\n",
       "      <td>0.495726</td>\n",
       "      <td>0.384615</td>\n",
       "      <td>0.170940</td>\n",
       "      <td>0.170940</td>\n",
       "      <td>1.250000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.058824</td>\n",
       "      <td>0</td>\n",
       "      <td>0.161901</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>?</td>\n",
       "      <td>1</td>\n",
       "      <td>42</td>\n",
       "      <td>0</td>\n",
       "      <td>2420</td>\n",
       "      <td>117</td>\n",
       "      <td>1</td>\n",
       "      <td>0.581197</td>\n",
       "      <td>0.125000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>http://www.bloomberg.com/news/2012-02-06/syria...</td>\n",
       "      <td>7640</td>\n",
       "      <td>{\"title\":\"Father s Tactics Used by Assad to Cr...</td>\n",
       "      <td>culture_politics</td>\n",
       "      <td>0.90259</td>\n",
       "      <td>2.523490</td>\n",
       "      <td>0.705502</td>\n",
       "      <td>0.346278</td>\n",
       "      <td>0.122977</td>\n",
       "      <td>0.090615</td>\n",
       "      <td>0.449366</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.058081</td>\n",
       "      <td>0</td>\n",
       "      <td>0.146593</td>\n",
       "      <td>0.005964</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>41</td>\n",
       "      <td>0</td>\n",
       "      <td>5559</td>\n",
       "      <td>309</td>\n",
       "      <td>10</td>\n",
       "      <td>0.038835</td>\n",
       "      <td>0.063126</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>http://www.wired.com/gadgetlab/2011/12/stem-tu...</td>\n",
       "      <td>3589</td>\n",
       "      <td>{\"title\":\"Stem Turns Lemons and Limes Into Jui...</td>\n",
       "      <td>science_technology</td>\n",
       "      <td>0.486363</td>\n",
       "      <td>1.848000</td>\n",
       "      <td>0.470968</td>\n",
       "      <td>0.161290</td>\n",
       "      <td>0.032258</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.453757</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.093023</td>\n",
       "      <td>0</td>\n",
       "      <td>0.244141</td>\n",
       "      <td>0.035714</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>34</td>\n",
       "      <td>0</td>\n",
       "      <td>2209</td>\n",
       "      <td>155</td>\n",
       "      <td>10</td>\n",
       "      <td>0.096774</td>\n",
       "      <td>0.065341</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                 url  urlid  \\\n",
       "0  http://www.lynnskitchenadventures.com/2009/04/...   5865   \n",
       "1            http://lolpics.se/18552-stun-grenade-ar    782   \n",
       "2  http://www.xcelerationfitness.com/treadmills.html   6962   \n",
       "3  http://www.bloomberg.com/news/2012-02-06/syria...   7640   \n",
       "4  http://www.wired.com/gadgetlab/2011/12/stem-tu...   3589   \n",
       "\n",
       "                                         boilerplate    alchemy_category  \\\n",
       "0  {\"title\":\"Homemade Enchilada Sauce Lynn s Kitc...          recreation   \n",
       "1  {\"title\":\"lolpics Stun grenade ar \",\"body\":\" f...    culture_politics   \n",
       "2  {\"title\":\"Treadmills \",\"body\":\" treadmills, st...                   ?   \n",
       "3  {\"title\":\"Father s Tactics Used by Assad to Cr...    culture_politics   \n",
       "4  {\"title\":\"Stem Turns Lemons and Limes Into Jui...  science_technology   \n",
       "\n",
       "  alchemy_category_score  avglinksize  commonlinkratio_1  commonlinkratio_2  \\\n",
       "0               0.443906     2.558140           0.389706           0.257353   \n",
       "1               0.135844     3.771429           0.461538           0.205128   \n",
       "2                      ?     2.269565           0.495726           0.384615   \n",
       "3                0.90259     2.523490           0.705502           0.346278   \n",
       "4               0.486363     1.848000           0.470968           0.161290   \n",
       "\n",
       "   commonlinkratio_3  commonlinkratio_4  compression_ratio  embed_ratio  \\\n",
       "0           0.044118           0.022059           0.489572          0.0   \n",
       "1           0.051282           0.000000           0.782051          0.0   \n",
       "2           0.170940           0.170940           1.250000          0.0   \n",
       "3           0.122977           0.090615           0.449366          0.0   \n",
       "4           0.032258           0.000000           0.453757          0.0   \n",
       "\n",
       "   framebased  frameTagRatio  hasDomainLink  html_ratio  image_ratio is_news  \\\n",
       "0           0       0.067143              0    0.230285     0.199438       1   \n",
       "1           0       0.042857              0    0.365962     0.080000       ?   \n",
       "2           0       0.058824              0    0.161901    10.000000       ?   \n",
       "3           0       0.058081              0    0.146593     0.005964       1   \n",
       "4           0       0.093023              0    0.244141     0.035714       1   \n",
       "\n",
       "   lengthyLinkDomain  linkwordscore news_front_page  \\\n",
       "0                  1             15               0   \n",
       "1                  1             62               0   \n",
       "2                  1             42               0   \n",
       "3                  1             41               0   \n",
       "4                  0             34               0   \n",
       "\n",
       "   non_markup_alphanum_characters  numberOfLinks  numwords_in_url  \\\n",
       "0                            5643            136                3   \n",
       "1                             382             39                2   \n",
       "2                            2420            117                1   \n",
       "3                            5559            309               10   \n",
       "4                            2209            155               10   \n",
       "\n",
       "   parametrizedLinkRatio  spelling_errors_ratio  \n",
       "0               0.242647               0.080597  \n",
       "1               0.128205               0.176471  \n",
       "2               0.581197               0.125000  \n",
       "3               0.038835               0.063126  \n",
       "4               0.096774               0.065341  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_test = pd.read_csv(get_path(\"test.tsv\"), sep=\"\\t\")\n",
    "df_test.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'{\"title\":\"IBM Sees Holographic Calls Air Breathing Batteries ibm sees holographic calls, air-breathing batteries\",\"body\":\"A sign stands outside the International Business Machines Corp IBM Almaden Research Center campus in San Jose California Photographer Tony Avelar Bloomberg Buildings stand at the International Business Machines Corp IBM Almaden Research Center campus in the Santa Teresa Hills of San Jose California Photographer Tony Avelar Bloomberg By 2015 your mobile phone will project a 3 D image of anyone who calls and your laptop will be powered by kinetic energy At least that s what International Business Machines Corp sees in its crystal ball The predictions are part of an annual tradition for the Armonk New York based company which surveys its 3 000 researchers to find five ideas expected to take root in the next five years IBM the world s largest provider of computer services looks to Silicon Valley for input gleaning many ideas from its Almaden research center in San Jose California Holographic conversations projected from mobile phones lead this year s list The predictions also include air breathing batteries computer programs that can tell when and where traffic jams will take place environmental information generated by sensors in cars and phones and cities powered by the heat thrown off by computer servers These are all stretch goals and that s good said Paul Saffo managing director of foresight at the investment advisory firm Discern in San Francisco In an era when pessimism is the new black a little dose of technological optimism is not a bad thing For IBM it s not just idle speculation The company is one of the few big corporations investing in long range research projects and it counts on innovation to fuel growth Saffo said Not all of its predictions pan out though IBM was overly optimistic about the spread of speech technology for instance When the ideas do lead to products they can have broad implications for society as well as IBM s bottom line he said Research Spending They have continued to do research when all the other grand research organizations are gone said Saffo who is also a consulting associate professor at Stanford University IBM invested 5 8 billion in research and development last year 6 1 percent of revenue While that s down from about 10 percent in the early 1990s the company spends a bigger share on research than its computing rivals Hewlett Packard Co the top maker of personal computers spent 2 4 percent last year At Almaden scientists work on projects that don t always fit in with IBM s computer business The lab s research includes efforts to develop an electric car battery that runs 500 miles on one charge a filtration system for desalination and a program that shows changes in geographic data IBM rose 9 cents to 146 04 at 11 02 a m in New York Stock Exchange composite trading The stock had gained 11 percent this year before today Citizen Science The list is meant to give a window into the company s innovation engine said Josephine Cheng a vice president at IBM s Almaden lab All this demonstrates a real culture of innovation at IBM and willingness to devote itself to solving some of the world s biggest problems she said Many of the predictions are based on projects that IBM has in the works One of this year s ideas that sensors in cars wallets and personal devices will give scientists better data about the environment is an expansion of the company s citizen science initiative Earlier this year IBM teamed up with the California State Water Resources Control Board and the City of San Jose Environmental Services to help gather information about waterways Researchers from Almaden created an application that lets smartphone users snap photos of streams and creeks and report back on conditions The hope is that these casual observations will help local and state officials who don t have the resources to do the work themselves Traffic Predictors IBM also sees data helping shorten commutes in the next five years Computer programs will use algorithms and real time traffic information to predict which roads will have backups and how to avoid getting stuck Batteries may last 10 times longer in 2015 than today IBM says Rather than using the current lithium ion technology new models could rely on energy dense metals that only need to interact with the air to recharge Some electronic devices might ditch batteries altogether and use something similar to kinetic wristwatches which only need to be shaken to generate a charge The final prediction involves recycling the heat generated by computers and data centers Almost half of the power used by data centers is currently spent keeping the computers cool IBM scientists say it would be better to harness that heat to warm houses and offices In IBM s first list of predictions compiled at the end of 2006 researchers said instantaneous speech translation would become the norm That hasn t happened yet While some programs can quickly translate electronic documents and instant messages and other apps can perform limited speech translation there s nothing widely available that acts like the universal translator in Star Trek Second Life The company also predicted that online immersive environments such as Second Life would become more widespread While immersive video games are as popular as ever Second Life s growth has slowed Internet users are flocking instead to the more 2 D environments of Facebook Inc and Twitter Inc Meanwhile a 2007 prediction that mobile phones will act as a wallet ticket broker concierge bank and shopping assistant is coming true thanks to the explosion of smartphone applications Consumers can pay bills through their banking apps buy movie tickets and get instant feedback on potential purchases all with a few taps on their phones The nice thing about the list is that it provokes thought Saffo said If everything came true they wouldn t be doing their job To contact the reporter on this story Ryan Flinn in San Francisco at rflinn bloomberg net To contact the editor responsible for this story Tom Giles at tgiles5 bloomberg net by 2015, your mobile phone will project a 3-d image of anyone who calls and your laptop will be powered by kinetic energy. at least that\\\\u2019s what international business machines corp. sees in its crystal ball.\",\"url\":\"bloomberg news 2010 12 23 ibm predicts holographic calls air breathing batteries by 2015 html\"}'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_train.boilerplate[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1    0.51332\n",
       "0    0.48668\n",
       "Name: label, dtype: float64"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_train.label.value_counts()/len(df_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json, re"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'a sign stands outside the international business machines corp ibm almaden research center campus in san jose california photographer tony avelar bloomberg buildings stand at the international business machines corp ibm almaden research center campus in the santa teresa hills of san jose california photographer tony avelar bloomberg by 2015 your mobile phone will project a 3 d image of anyone who calls and your laptop will be powered by kinetic energy at least that s what international business machines corp sees in its crystal ball the predictions are part of an annual tradition for the armonk new york based company which surveys its 3 000 researchers to find five ideas expected to take root in the next five years ibm the world s largest provider of computer services looks to silicon valley for input gleaning many ideas from its almaden research center in san jose california holographic conversations projected from mobile phones lead this year s list the predictions also include air breathing batteries computer programs that can tell when and where traffic jams will take place environmental information generated by sensors in cars and phones and cities powered by the heat thrown off by computer servers these are all stretch goals and that s good said paul saffo managing director of foresight at the investment advisory firm discern in san francisco in an era when pessimism is the new black a little dose of technological optimism is not a bad thing for ibm it s not just idle speculation the company is one of the few big corporations investing in long range research projects and it counts on innovation to fuel growth saffo said not all of its predictions pan out though ibm was overly optimistic about the spread of speech technology for instance when the ideas do lead to products they can have broad implications for society as well as ibm s bottom line he said research spending they have continued to do research when all the other grand research organizations are gone said saffo who is also a consulting associate professor at stanford university ibm invested 5 8 billion in research and development last year 6 1 percent of revenue while that s down from about 10 percent in the early 1990s the company spends a bigger share on research than its computing rivals hewlett packard co the top maker of personal computers spent 2 4 percent last year at almaden scientists work on projects that don t always fit in with ibm s computer business the lab s research includes efforts to develop an electric car battery that runs 500 miles on one charge a filtration system for desalination and a program that shows changes in geographic data ibm rose 9 cents to 146 04 at 11 02 a m in new york stock exchange composite trading the stock had gained 11 percent this year before today citizen science the list is meant to give a window into the company s innovation engine said josephine cheng a vice president at ibm s almaden lab all this demonstrates a real culture of innovation at ibm and willingness to devote itself to solving some of the world s biggest problems she said many of the predictions are based on projects that ibm has in the works one of this year s ideas that sensors in cars wallets and personal devices will give scientists better data about the environment is an expansion of the company s citizen science initiative earlier this year ibm teamed up with the california state water resources control board and the city of san jose environmental services to help gather information about waterways researchers from almaden created an application that lets smartphone users snap photos of streams and creeks and report back on conditions the hope is that these casual observations will help local and state officials who don t have the resources to do the work themselves traffic predictors ibm also sees data helping shorten commutes in the next five years computer programs will use algorithms and real time traffic information to predict which roads will have backups and how to avoid getting stuck batteries may last 10 times longer in 2015 than today ibm says rather than using the current lithium ion technology new models could rely on energy dense metals that only need to interact with the air to recharge some electronic devices might ditch batteries altogether and use something similar to kinetic wristwatches which only need to be shaken to generate a charge the final prediction involves recycling the heat generated by computers and data centers almost half of the power used by data centers is currently spent keeping the computers cool ibm scientists say it would be better to harness that heat to warm houses and offices in ibm s first list of predictions compiled at the end of 2006 researchers said instantaneous speech translation would become the norm that hasn t happened yet while some programs can quickly translate electronic documents and instant messages and other apps can perform limited speech translation there s nothing widely available that acts like the universal translator in star trek second life the company also predicted that online immersive environments such as second life would become more widespread while immersive video games are as popular as ever second life s growth has slowed internet users are flocking instead to the more 2 d environments of facebook inc and twitter inc meanwhile a 2007 prediction that mobile phones will act as a wallet ticket broker concierge bank and shopping assistant is coming true thanks to the explosion of smartphone applications consumers can pay bills through their banking apps buy movie tickets and get instant feedback on potential purchases all with a few taps on their phones the nice thing about the list is that it provokes thought saffo said if everything came true they wouldn t be doing their job to contact the reporter on this story ryan flinn in san francisco at rflinn bloomberg net to contact the editor responsible for this story tom giles at tgiles5 bloomberg net by 2015 your mobile phone will project a 3 d image of anyone who calls and your laptop will be powered by kinetic energy at least that s what international business machines corp sees in its crystal ball '"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def preprocess(boilerplate):\n",
    "    d = json.loads(boilerplate)\n",
    "    body = d[\"body\"]\n",
    "    if body is not None:\n",
    "        # Remove html tags\n",
    "        text = BeautifulSoup(body.lower(), \"html5lib\").text \n",
    "        # Replace the occurrences of multiple consecutive whilespaces \n",
    "        # with a single space (\" \")\n",
    "        text = re.sub(r\"[\\W]+\", \" \", text)\n",
    "        return text\n",
    "    return \"\"\n",
    "\n",
    "preprocess(df_train.boilerplate[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 5.32 s, sys: 18.4 ms, total: 5.34 s\n",
      "Wall time: 5.34 s\n"
     ]
    }
   ],
   "source": [
    "%%time \n",
    "df_train[\"body\"]= df_train.boilerplate.apply(preprocess)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 2.3 s, sys: 8.74 ms, total: 2.31 s\n",
      "Wall time: 2.31 s\n"
     ]
    }
   ],
   "source": [
    "%%time \n",
    "df_test[\"body\"]= df_test.boilerplate.apply(preprocess)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "import nltk"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['yellowston', 'nation', 'park', 'warm', 'brought', 'rapid', 'chang']"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def my_tokenizer(s):\n",
    "    porter = nltk.stem.porter.PorterStemmer()\n",
    "    terms = [porter.stem(w) for w in nltk.word_tokenize(s)]\n",
    "    terms = [term for term in terms if len(term) > 2]\n",
    "    return terms\n",
    "my_tokenizer(\"In Yellowstone National Park, warming has brought rapid changes.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn import feature_extraction"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "stopwords = nltk.corpus.stopwords.words(\"english\")\n",
    "tfidf = feature_extraction.text.TfidfVectorizer( \n",
    "                      tokenizer=my_tokenizer\n",
    "                    , stop_words = stopwords\n",
    "                    , ngram_range=(1, 1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 51 s, sys: 47.1 ms, total: 51 s\n",
      "Wall time: 51 s\n"
     ]
    }
   ],
   "source": [
    "%%time \n",
    "body_train_tfidf = tfidf.fit_transform(df_train.body)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 21.3 s, sys: 13.5 ms, total: 21.3 s\n",
      "Wall time: 21.3 s\n"
     ]
    }
   ],
   "source": [
    "%%time \n",
    "body_test_tfidf = tfidf.transform(df_test.body)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((7395, 65284), (3171, 65284))"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "body_train_tfidf.shape, body_test_tfidf.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "scipy.sparse.csr.csr_matrix"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(body_train_tfidf)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['url', 'urlid', 'boilerplate', 'alchemy_category',\n",
       "       'alchemy_category_score', 'avglinksize', 'commonlinkratio_1',\n",
       "       'commonlinkratio_2', 'commonlinkratio_3', 'commonlinkratio_4',\n",
       "       'compression_ratio', 'embed_ratio', 'framebased', 'frameTagRatio',\n",
       "       'hasDomainLink', 'html_ratio', 'image_ratio', 'is_news',\n",
       "       'lengthyLinkDomain', 'linkwordscore', 'news_front_page',\n",
       "       'non_markup_alphanum_characters', 'numberOfLinks', 'numwords_in_url',\n",
       "       'parametrizedLinkRatio', 'spelling_errors_ratio', 'label', 'body'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_train.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(10566, 20)\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:9: FutureWarning: Sorting because non-concatenation axis is not aligned. A future version\n",
      "of pandas will change to not sort by default.\n",
      "\n",
      "To accept the future behavior, pass 'sort=False'.\n",
      "\n",
      "To retain the current behavior and silence the warning, pass 'sort=True'.\n",
      "\n",
      "  if __name__ == '__main__':\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "((7395, 20), (3171, 20))"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "columns = ['avglinksize', 'commonlinkratio_1',\n",
    "       'commonlinkratio_2', 'commonlinkratio_3', 'commonlinkratio_4',\n",
    "       'compression_ratio', 'embed_ratio', 'framebased', 'frameTagRatio',\n",
    "       'hasDomainLink', 'html_ratio', 'image_ratio', 'is_news',\n",
    "       'lengthyLinkDomain', 'linkwordscore', \n",
    "       'non_markup_alphanum_characters', 'numberOfLinks', 'numwords_in_url',\n",
    "       'parametrizedLinkRatio', 'spelling_errors_ratio'] \n",
    "#'news_front_page', 'alchemy_category_score'\n",
    "X = pd.concat([df_train, df_test])[columns]\n",
    "X = pd.get_dummies(X, drop_first=True)\n",
    "print(X.shape)\n",
    "\n",
    "X_train  = X.iloc[:len(df_train), :]\n",
    "X_test  = X.iloc[len(df_train):, :]\n",
    "X_train.shape, X_test.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn import preprocessing"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "import scipy as sp\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "scaler = preprocessing.StandardScaler()\n",
    "X_train = scaler.fit_transform(X_train)\n",
    "X_test = scaler.transform(X_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train = sp.sparse.hstack((X_train, body_train_tfidf))\n",
    "X_test = sp.sparse.hstack((X_test, body_test_tfidf))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((7395, 65304), (3171, 65304))"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_train.shape, X_test.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "label_encoder = preprocessing.LabelEncoder()\n",
    "y_train = label_encoder.fit_transform(df_train.label)\n",
    "#y_test = label_encoder.transform(df_test.label)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn import linear_model, metrics, model_selection"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Accuracy:  0.7945020279405137\n",
      "CPU times: user 13.4 s, sys: 16.2 ms, total: 13.4 s\n",
      "Wall time: 12.5 s\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "X1, X2, y1, y2 = model_selection.train_test_split(X_train, y_train, test_size = 0.3, random_state = 1)\n",
    "lr = linear_model.LogisticRegression(C = 1.0, random_state = 1, max_iter=10000\n",
    "                            , n_jobs = 12, solver=\"saga\")\n",
    "lr.fit(X1, y1)\n",
    "y2_pred = lr.predict(X2)\n",
    "print(\"Accuracy: \", metrics.accuracy_score(y2, y2_pred))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Submission"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 19.4 s, sys: 37.1 ms, total: 19.5 s\n",
      "Wall time: 18.5 s\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "lr = linear_model.LogisticRegression(random_state = 1, max_iter=5000\n",
    "                            , n_jobs = 12, solver=\"saga\")\n",
    "lr.fit(X_train, y_train)\n",
    "y_test_pred = lr.predict(X_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>urlid</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1712</th>\n",
       "      <td>5326</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1951</th>\n",
       "      <td>2600</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3072</th>\n",
       "      <td>8167</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>732</th>\n",
       "      <td>10492</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1580</th>\n",
       "      <td>1873</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2286</th>\n",
       "      <td>5480</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3134</th>\n",
       "      <td>892</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3038</th>\n",
       "      <td>4382</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>905</th>\n",
       "      <td>6172</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>268</th>\n",
       "      <td>4523</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      urlid  label\n",
       "1712   5326      1\n",
       "1951   2600      0\n",
       "3072   8167      0\n",
       "732   10492      1\n",
       "1580   1873      0\n",
       "2286   5480      0\n",
       "3134    892      1\n",
       "3038   4382      1\n",
       "905    6172      1\n",
       "268    4523      1"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "submission = pd.DataFrame({\"urlid\": df_test.urlid, \"label\": y_test_pred})\n",
    "submission.sample(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "submission.to_csv(\"/tmp/submission.csv\", index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
